<template>
    <div class="mui-numbox" data-numbox-min="1" >
      <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
      <input id="test" class="mui-input-numbox" type="number" value="1" @change="cnum" ref="number">
      <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script>
import mui from '../../lib/mui/js/mui.js'
export default {
  mounted(){
    //初始化数字选择框组件
    mui(".mui-numbox").numbox();
  },
  methods:{
    cnum(){
      let num = this.$refs.number.value;
      // alert(num);
      this.$emit('changenumber',parseInt(num));
    }
  },
  props:["max"],
  watch:{
    'max':function(newValue,oldValue){
      mui(".mui-numbox").numbox().setOption('max',newValue)
    }
  }
};
</script>

<style>
</style>
